$.ajaxSetup({
	contentType : "application/x-www-form-urlencoded;charset=utf-8",
	complete : function(XMLHttpRequest, textStatus) {
		console.log("complete");
		var sessionstatus = XMLHttpRequest.getResponseHeader("sessionStatus"); // 通过XMLHttpRequest取得响应头，sessionstatus，
		if (sessionstatus == "timeOut") {
			alert("登录超时,请重新登录！");
			// 如果超时就处理 ，指定要跳转的页面
			window.location.replace(_ctx + "/login");
		}
	}
});

function bootstrapAlert(title, content, okBtnText) {
	var modal = $("#publicModal");
	$('.modal-title', modal).text(title);
	$('.modal-body p', modal).text(content);
	$($('.modal-footer button', modal)[0]).hide();
	var okBtn = $($('.modal-footer button', modal)[1]);
	okBtn.unbind();
	okBtn.removeClass();
	okBtn.addClass("btn btn-info")
	okBtn.text("确定");
	modal.modal('show');
}

function bootstrapComfire(title, content, calBtnText, okBtnText, callback) {
	var modal = $("#publicModal");
	$('.modal-title', modal).text(title);
	$('.modal-body p').text(content);
	var calBtn = $($('.modal-footer button', modal)[0]);
	calBtn.show();
	calBtn.text(calBtnText);
	var okBtn = $($('.modal-footer button', modal)[1]);
	okBtn.removeClass();
	okBtn.addClass("btn btn-danger")
	okBtn.text(okBtnText);
	okBtn.unbind();
	okBtn.click(callback);
	modal.modal('show');
}

function blockUIGrowUIMsg(content, level) {
	var bgColor = '#5bc0de';
	if (level == "success") {
		bgColor = "#dff0d8";
	} else if (level == "warn") {
		bgColor = "#f0ad4e"
	} else if (level == "danger") {
		bgColor = "#d9534f"
	}
	$.blockUI({
		message : "<p style='color:white;margin:20px;font-size:25px'>"
				+ content + "</p>",
		fadeIn : 700,
		fadeOut : 700,
		timeout : 2500,
		showOverlay : false,
		css : {
			border : 'none',
			padding : '0px',
			'background-color' : bgColor,
			border : '1px solid #e3e3e3',
			'border-radius' : '10px',
			'-webkit-box-shadow' : 'inset 0 1px 1px rgba(0,0,0,.05)',
			'box-shadow' : 'inset 0 1px 1px rgba(0,0,0,.05)',
			cursor : 'default'
		}
	});
}
